package edu.utexas.ipc;

public class LamportClock implements Clock {

    private int c;
    
    public LamportClock() {
        c = 1;
    }
    
    public int getValue() {
        return c;
    }
    
    public void tick() { // on internal actions
        c = c + 1;
    }
    
    public void receiveAction(int srcID, int sentValue) {
        c = Math.max(c, sentValue) + 1;
    }
   
	public void update(int srcID, String timestamp) {
		receiveAction(srcID, Integer.parseInt(timestamp));
	}

	public String value() {
		return Integer.toString(getValue());
	}
}
